package com.erlang4j.internal.utilities;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

/** A few static helper methods for manipulating collections and arrays */
public class Erlang4jCollectionHelper {

	public static <T> Set<T> getSet(T... items) {
		Set<T> result = new HashSet<T>();
		for (T t : items)
			result.add(t);
		return result;
	}

	public static <T> T[] join(T t, T... ts) {
		List<T> result = new ArrayList<T>();
		result.add(t);
		result.addAll(Arrays.asList(ts));
		return result.toArray(ts);
	}
}
